package com.fun.ex.app;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.text.HtmlCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.fun.library.HtmlTextView;

public class MainActivity extends AppCompatActivity {

    HtmlTextView htmlTextView;
    String str = "<font color='blue'>测试HTML标签：</font>" +
            "<br>1、显示网络图片1 <img src = \"http://static.dev.epetbar.com/static_www/goods_detail_dev/toBrand.png\" />" +
            "<br>2、网络图片2：<img src=\"http://img2.epetbar.com/brand/brandLogo/purchase_suppliers_file_1537174351.png\" />" +
            "<br>3、网络图片3：<img src=\"http://img2.epetbar.com/nowater/brand_logo/2018-03/07/15/6360b2e4d7a84a5b760db9f4545a813a.jpg\">" +
            "<br>4、网络图片4：<img src=\"http://img2.epetbar.com/brand/brandLogo/upload_file_1542336567.jpg\">" +
            "<br>5、Assets图片：<img src=\"assets://as_img_wx.png\"/>" +
            "<br>6、项目资源图片：<img src=\"drawable://mine_order_s4\"/>" +
            "<br>7、显示缺省图：<img src=\"mipmap://xxx.png\">";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_layout);
        this.htmlTextView = this.findViewById(R.id.activity3_text1);
        this.htmlTextView.setHtml(str);

        TextView textView = findViewById(R.id.text2);
        textView.setText(HtmlCompat.fromHtml(str, HtmlCompat.FROM_HTML_MODE_LEGACY));
    }

    public void testList(View view) {
        startActivity(new Intent(this, ListActivity.class));
    }
}